﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * ZIP Local File Header Class
 * 		Represents and manages the header data for each individual entry in a
 * ZIP file.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;
using System.IO;

namespace Adaptive.Foundation.IO.Zip
{
    /// <summary>
    /// Represents and manages the header data for each individual entry in a
    /// ZIP file.
    /// </summary>
    /// <remarks>
    /// Each compressed data entry is preceeded by a local file header.
    /// </remarks>
    public sealed class ZipLocalFileHeader : ZipHeaderBase
    {
        /*--------------------------------------------------------------------------------
         * Constructor / Dispose / Destructor Methods
         *------------------------------------------------------------------------------*/
        #region Constructor / Dispose / Destructor Methods
        /// <summary>
        /// Initializes a new instance of the <see cref="ZipLocalFileHeader" /> class.
        /// </summary>
        /// <remarks>
        /// This is the default constructor.
        /// </remarks>
        public ZipLocalFileHeader()
            : base()
        {
        }
        #endregion

        /*--------------------------------------------------------------------------------
         * Protected Methods
         *------------------------------------------------------------------------------*/
        #region Protected Methods
        /// <summary>
        /// Creates the 4 data bytes that make up the signature value used to identify
        /// the header.
        /// </summary>
        /// <returns>The signature value as a 4-byte array.</returns>
        protected override byte[] CreateSignatureDefaultValue()
        {
            return new Byte[] { 80, 75, 3, 4 };
        }
        /// <summary>
        /// Reads any fields not defined on the base class.
        /// </summary>
        /// <param name="reader">An open <see cref="BinaryReader" /> used to read the contents</param>
        /// <remarks>
        /// This allows different child implementations to read (or not read) and interpret
        /// this data as needed.
        /// </remarks>
        protected override void ReadExtraFields(BinaryReader reader)
        {
        }
        /// <summary>
        /// Reads any remaining data in the structure.
        /// </summary>
        /// <param name="reader">An open <see cref="BinaryReader" /> used to read the contents</param>
        /// <remarks>
        /// This allows different child implementations to read (or not read) and interpret
        /// this data as needed.
        /// </remarks>
        protected override void ReadRemainingData(BinaryReader reader)
        {
        }
        /// <summary>
        /// Reads the version-made-by versioning value.
        /// </summary>
        /// <param name="reader">An open <see cref="BinaryReader" /> used to read the contents</param>
        /// <remarks>
        /// This allows different child implementations to read (or not read) and interpret
        /// this data as needed.
        /// </remarks>
        protected override void ReadVersionMadeBy(BinaryReader reader)
        {
        }
        /// <summary>
        /// Writes any fields not defined on the base class.
        /// </summary>
        /// <param name="writer">An open <see cref="BinaryWriter" /> used to writer the contents</param>
        /// <remarks>
        /// This allows different child implementations to write (or not write)
        /// this data as needed.
        /// </remarks>
        protected override void WriteExtraFields(BinaryWriter writer)
        { }
        /// <summary>
        /// Writes any remaining data in the structure.
        /// </summary>
        /// <param name="writer">An open <see cref="BinaryWriter" /> used to writer the contents</param>
        /// <remarks>
        /// This allows different child implementations to write (or not write)
        /// this data as needed.
        /// </remarks>
        protected override void WriteRemainingData(BinaryWriter writer)
        { }
        /// <summary>
        /// Writes the made-by versioning data.
        /// </summary>
        /// <param name="writer">
        /// An open <see cref="BinaryWriter"/> used to writer the contents 
        /// </param>
        /// <remarks>
        /// This allows different child implementations to write (or not write) 
        /// this data as needed.
        /// </remarks>
        protected override void WriteVersionMadeBy(BinaryWriter writer)
        { }
        #endregion
    }
}
